/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package emprestimo.frames;

import javax.swing.plaf.basic.BasicInternalFrameUI;
import utilitarios.Validar;

/**
 *
 * @author Ar0n
 */
public class LoanFrameCad extends javax.swing.JInternalFrame {

    /**
     * Creates new form BookFrame
     */
    public LoanFrameCad() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel19 = new javax.swing.JLabel();
        jTRg = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jTISBN = new javax.swing.JTextField();
        jTNumSeq = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jDesktop = new javax.swing.JDesktopPane();

        setClosable(true);

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel19.setText("<html>RG:<b color=\"red\">*</b></html>");
        jLabel19.setPreferredSize(new java.awt.Dimension(20, 15));

        jTRg.setPreferredSize(new java.awt.Dimension(0, 10));
        jTRg.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTRgKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTRgKeyReleased(evt);
            }
        });

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel20.setText("<html>ISBN:<b color=\"red\">*</b></html>");
        jLabel20.setPreferredSize(new java.awt.Dimension(20, 15));

        jTISBN.setPreferredSize(new java.awt.Dimension(0, 10));
        jTISBN.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTISBNKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTISBNKeyReleased(evt);
            }
        });

        jTNumSeq.setPreferredSize(new java.awt.Dimension(0, 10));
        jTNumSeq.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTNumSeqKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTNumSeqKeyReleased(evt);
            }
        });

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel21.setText("<html>Número Sequência:<b color=\"red\">*</b></html>");
        jLabel21.setPreferredSize(new java.awt.Dimension(20, 15));

        jDesktop.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                jDesktopAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(138, 138, 138)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jTNumSeq, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jTISBN, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jTRg, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(146, Short.MAX_VALUE))
            .addComponent(jDesktop, javax.swing.GroupLayout.Alignment.TRAILING)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(185, 185, 185)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTRg, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTISBN, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTNumSeq, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 185, Short.MAX_VALUE)
                .addComponent(jDesktop, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jTRgKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTRgKeyPressed
        Validar.validaNum(jTRg, 11);
    }//GEN-LAST:event_jTRgKeyPressed

    private void jTRgKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTRgKeyReleased
        Validar.validaNum(jTRg, 11);
    }//GEN-LAST:event_jTRgKeyReleased

    private void jTISBNKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTISBNKeyPressed
        Validar.validaNum(jTISBN, 13);
    }//GEN-LAST:event_jTISBNKeyPressed

    private void jTISBNKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTISBNKeyReleased
        Validar.validaNum(jTISBN, 13);
    }//GEN-LAST:event_jTISBNKeyReleased

    private void jTNumSeqKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTNumSeqKeyPressed
        Validar.validaNum(jTNumSeq, 4);
    }//GEN-LAST:event_jTNumSeqKeyPressed

    private void jTNumSeqKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTNumSeqKeyReleased
        Validar.validaNum(jTNumSeq, 4);
    }//GEN-LAST:event_jTNumSeqKeyReleased

    private void jDesktopAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jDesktopAncestorAdded
        LoanFrameSave loanFrameSave = new LoanFrameSave();
        jDesktop.add(loanFrameSave);
        loanFrameSave.show();
        //retirando bordas do internalJframe
        ((BasicInternalFrameUI)loanFrameSave.getUI()).setNorthPane(null);
        loanFrameSave.setBorder(null);
        //pegando dimenções do JDesktop no qual ele esta encapsulado
        loanFrameSave.setBounds(0, 0, jDesktop.getWidth(), jDesktop.getHeight());
        loanFrameSave.setResizable(false);
    }//GEN-LAST:event_jDesktopAncestorAdded

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane jDesktop;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    public javax.swing.JTextField jTISBN;
    public javax.swing.JTextField jTNumSeq;
    public javax.swing.JTextField jTRg;
    // End of variables declaration//GEN-END:variables
    //atributos
    private boolean estado;
    //métodos
    public boolean getEstado() {
        return estado;
    }

    public void setEstado(boolean estado) {
        this.estado = estado;
    }
    
}
